Method of classification of images among different classes

ABSTRACT

This invention relates to a method of classification of images among different classes comprising: performing a dimensionality reduction step for said different classes on a training set of images whose classes are known, and then classifying one or more unknown images among said different classes with reduced dimensionality, said dimensionality reduction step being performed on said training set of images by machine learning including processing, for at least a first matrix and for at least a second matrix, a parameter representative of a product of two first and second matrices to assess to which given classes several first given images respectively belong: first matrix representing the concatenation, for said several first given images, of the values of the pixels of each said first given image, second matrix representing the concatenation, for said several first given images, of the values of differences between the pixels of each said first given image and the pixels of a second given image different from said first given image but known to belong to same class as said first given image, wherein: a quantum singular value estimation is performed on first matrix, a quantum singular value estimation is performed on second matrix, both quantum singular value estimation of first matrix and quantum singular value estimation of second matrix are combined together, via quantum calculation, so as to get at a quantum singular value estimation of said product of both first and second matrices, said quantum singular value estimation of said product of both first and second matrices being said parameter representative of said product of two first and second matrices processed to assess to which given classes said several first given images respectively belong.

CROSS-REFERENCE TO RELATED APPLICATIONS

This specification is based upon and claims the benefit of priority fromEuropean patent application number EP 18306859.2 filed on Dec. 27, 2018,the entire contents of which are incorporated herein by reference.

FIELD OF THE INVENTION

The invention relates to methods of classification of images amongdifferent classes of images.

BACKGROUND OF THE INVENTION

Machine learning is focused on creating new algorithms based onprobability theory and statistics to perform tasks such asclassification or regression. Classification is the task of assigning alabel to an unseen data point given a training set of previouslyclassified elements. Regression is the task of learning an unknownfunction from a set of points sampled from the function. Patternrecognition is one of the most established approaches to classification,and image classification is one of the most studied applications ofpattern recognition.

The majority of algorithms in machine learning rely on an embeddingbetween the data analyzed and a mathematical structure, like a vectorspace. Quantum mechanics is a theory that models with mostly linearalgebra the behavior of particles at the smallest scales of energy. Itis believed that quantum computers can offer an exponential speedup interms of data processing capabilities.

The aim of the invention is to set up a method to perform classificationusing in some intermediate steps a quantum computer. In order to provethe validity of this approach, this procedure will be executed on adataset of handwritten digits, where it will be managed to reach up to98% accuracy. The method of classification of image among classescontemplated by the invention can either be performed directly via thecomputation described in the algorithm, or via simulation with classicalcomputer of the operations that the quantum computer is supposed to run.

A big issue in image classification is the curse of dimensionality.Informally, the curse of dimensionality states that the number of datapoints in the training set should increase exponentially with thedimension of the space embedding the elements. This is because in bigspaces the informative power of a single point decreases, and thus abigger training set is needed. Since is not always possible to acquire,store, or process such number of vectors, one of the known solution isto perform a dimensionality reduction therefore, i.e. moving the vectorsfrom a high dimensional space to a lower dimensional space, but whilekeeping as much as information as possible.

Therefore, algorithms for doing dimensionality reduction beforeclassification have emerged. These algorithms often use linear algebra,and the operation that they often need in the algorithms are matrixinversion and matrices multiplication. Given the size of these datasets,these operations are computationally demanding even for supercomputers.More clever techniques to process the data are needed. Therefore,according to the invention, quantum computers offer alternatives to theparadigm of classical computation also for the method of classificationof images among different classes. The invention will use quantumsingular value estimation procedures to build the subroutine thatperforms the dimensionality reduction. Quantum interference is used toperform classification with high accuracy and efficiently.

There are classical algorithms for classification and dimensionalityreduction and classification. For instance PCA is a known DR algorithmthat projects the dataset in the subspace that holds most of theinformation of the original data, but it lacks the ability to take intoconsideration the shape of the clusters. Linear fisher discriminant is aclassical algorithm that partly solves this problem, by taking intoconsideration the variance of each cluster, and projecting over asubspace that maximize the distance between clusters in the projectedpoints.

There are also classical algorithms to perform pattern matching andimage classification, before or after dimensionality reduction. Forinstance, a current paradigm is that of neural networks, where a layerof artificial neurons are connected by edges with certain weights, andthe weights are adjusted such that the neural network mimics the desiredinput-output mapping described by the elements in the dataset.

Other solutions proposed so far are meant to be executed on classicalcomputer, and thus, the running time needed to train the classifiercannot be less than linear in the dimension of the vectors and theinitial input space that encodes the features. Due to the complexity ofmatrix inversion and matrices multiplication, the running time of theclassical algorithms between the square and the cube of the dimension ofthe matrices, thus the time needed to run these procedures raisesdrastically with the amount of data produced nowadays.

Current quantum algorithms for machine learning are not targeted onimage classification and are based on more trivial procedure that do notinvolve performing linear algebraic operations performed on quantumcomputers, thus the invention represents an unprecedented innovation inthe field of quantum machine learning.

The performances of a classification algorithm are measured usingseveral possible metrics. One of these is classification accuracy: thepercentage of correctly classified values in a set of patterns whoselabels are known, but are not used in the training procedure.

SUMMARY OF THE INVENTION

The object of the present invention is to alleviate at least partly theabove mentioned drawbacks.

More particularly, the invention aims to a method of classification ofimages among different classes which fulfills a good compromise betweenon the one hand its accuracy and on the other hand its rapidity. Indeed,in embodiments of the invention, the accuracy is somewhat better than inprior art, whereas the rapidity is much higher, because of by-passingvery demanding calculations, and replacing them by much easier indeedfaster to execute, but still sufficient indeed equivalent for thecontemplated application, satisfactory calculations.

This invention is the result of the meeting of two very differenttechnical fields which are far away from each other: the technical fieldof image processing on the one side, where there are many very practicalproblems to solve but few, if any, effective solutions to work, and thetechnical field of quantum circuit and quantum computer, on the otherside, where there are quite amazing theoretical tools but littlepractical and interesting application to confirm practical interest.

Indeed:

-   -   the technical field of image processing attends to replace human        know-how on image recognition and image classification which are        both very difficult tasks where the human brain mysteriously        easily succeeds whereas the computer, on the contrary, even when        quite powerful, often seems at a loss of becoming successful in        a repeated and reliable way, because:        -   classical computers, even high performance clusters' of            classical computers, do not give very good results, even if            the global capabilities of the whole cluster contemplated            looks impressive,        -   computers based on neural networks may give better results            but they are not so difficult to implement, but they are            quite difficult and very slow to train in an efficient way,            once more all the more in a repeated and reliable way,    -   the technical field of quantum circuit computation is a rather        brand new technology, at least for practical applications, even        if theory has been developed decades ago,        -   which is fast growing, which looks like very promising in            solving at least some types of rather specific calculation            problems,        -   but which is not yet fully convincing in building algorithms            which can really be considered both as useful and efficient,            and which would successfully solve practical and interesting            problems, not only show theoretical capabilities in solving            abstract and specific calculation problems thereby            advantageously comparing with more classical computers.

In the application of image classification, a lot of calculations areimplied.

In the core of these complex calculations, the invention has identifieda particularly difficult calculating step to perform.

The invention rather proposes to by-pass this “particularly difficultcalculating step” than to perform it, and to replace it by an easiercalculating step practically as efficient as this “particularlydifficult calculating step” in specific circumstances of implementation.

The invention proposes to implement a specific trick made possible byquantum calculation in order to by-pass a specific difficulty within thefull processing of image classification.

The invention proposes that:

-   -   instead of calculating the product of two huge matrices which        both matrices represent two different images and which product        is required to correctly perform image classification via        performing dimensionality reduction for different classes of        images, these huge matrices may also represent many of such        different images,    -   first, only the eigenvalues of both these matrices are        estimated, and second, the eigenvalues of the product of these        matrices is directly estimated from the eigenvalues of both        these matrices,    -   without effectively calculating this product of matrices,    -   taking into account the fact that, knowing only the eigenvalues        of this product of matrices is sufficient indeed, and that, it        is indeed not compulsory to effectively calculate this product        of matrices in order to correctly perform image classification.

This invention may be applied more generally to other problems implyinga product of two huge matrices performed within a dimensionalityreduction step in any method of analysis of images other than imageclassification, deeming to replace human know-how in order to automatesuch image analysis, and to automate it in a much quicker way than themanual way.

To implement this dimensionality reduction step including a firstestimation of only the eigenvalues of both these matrices and a secondestimation of the eigenvalues of the product of these matrices directlyperformed from the eigenvalues of both these matrices and withouteffectively calculating this product of matrices, the invention alsoproposes:

-   -   a phase estimation of an entity performing some specific quantum        steps,    -   and/or a specific quantum circuit based on Hadamard gates and on        inverted quantum Fourier transform components, used a specific        way by successive implementations of both matrices in a quantum        memory controlled by at least part of these Hadamard gates and        these inverted quantum Fourier transform components.

Machine learning techniques are used in combination with quantumcircuits, either deep learning or other machine learning method. Thiscombination, between a technique offering rich tools to mimic humanbehavior and another technique offering huge calculating capabilitiesfar beyond the human brain, has ended up into a very powerful efficiencywhile still keeping flexibility.

Neural network also could be used in combination with quantum circuits.

This object is achieved with a method of classification of images amongdifferent classes comprising: performing a dimensionality reduction stepfor said different classes on a training set of images whose classes areknown, and then classifying one or more unknown images among saiddifferent classes with reduced dimensionality, said dimensionalityreduction step being performed on said training set of images by machinelearning including processing, for at least a first matrix and for atleast a second matrix, a parameter representative of a product of twofirst and second matrices to assess to which given classes several firstgiven images respectively belong: first matrix representing theconcatenation, for said several first given images, of the values of thepixels of each said first given image, second matrix representing theconcatenation, for said several first given images, of the values ofdifferences between the pixels of each said first given image and thepixels of a second given image different from said first given image butknown to belong to same class as said first given image, wherein: aquantum singular value estimation is performed on first matrix, aquantum singular value estimation is performed on second matrix, bothquantum singular value estimation of first matrix and quantum singularvalue estimation of second matrix are combined together, via quantumcalculation, so as to get at a quantum singular value estimation of saidproduct of both first and second matrices, said quantum singular valueestimation of said product of both first and second matrices being saidparameter representative of said product of two first and secondmatrices processed to assess to which given class said first given imagebelongs.

This object is also achieved with a method of analysis of imagescomprising: performing a dimensionality reduction step, by processing,for several first matrices and for several second matrices, a parameterrepresentative of a product of both first and second matricesrespectively representing the pixels of both a first and a secondimages, wherein: a quantum singular value estimation is performed onfirst matrix, a quantum singular value estimation is performed on secondmatrix, both quantum singular value estimation of first matrix andquantum singular value estimation of second matrix are combinedtogether, via quantum calculation, so as to get at a quantum singularvalue estimation of said product of both first and second matrices, saidquantum singular value estimation of said product of both first andsecond matrices being said parameter representative of said product ofboth first and second matrices.

This object is also achieved with a method of analysis of imagescomprising: performing a dimensionality reduction step, by processing,for several first matrices and for several second matrices, a parameterrepresentative of a product of both first and second matricesrespectively representing the pixels of both a first and a secondimages, wherein: both quantum singular value estimation of first matrixand quantum singular value estimation of second matrix are estimatedeach and are combined together so as to get at a quantum singular valueestimation of said product of both first and second matrices, by makinga phase estimation of an entity at least successively performing:quantum singular value estimation of first matrix, quantum rotations,proportional to estimated singular values of first matrix, preferablyquantum rotations on Y axis of Bloch sphere, proportional to estimatedsingular values of first matrix, quantum singular value estimation ofsecond matrix, quantum rotations, proportional to estimated singularvalues of second matrix, preferably quantum rotations on Y axis of Blochsphere, proportional to estimated singular values of second matrix, saidquantum singular value estimation of said product of both first andsecond matrices being said parameter representative of said product ofboth first and second matrices.

This object is also achieved with a method of analysis of imagescomprising: performing a dimensionality reduction step, by processing,for several first matrices and for several second matrices, a parameterrepresentative of a product of both first and second matricesrespectively representing the pixels of both a first and a secondimages, wherein: both quantum singular value estimation of first matrixand quantum singular value estimation of second matrix are estimatedeach and are combined together so as to get at a quantum singular valueestimation of said product of both first and second matrices, byapplying to both first and second matrices following quantum circuitincluding: a first Hadamard gate whose output is the input of a firstinverted quantum Fourier transform, said first Hadamard outputcontrolling following sub-circuit, a second Hadamard gate whose outputis the input of a second inverted quantum Fourier transform, said secondHadamard output controlling a quantum memory, output of said firstinverted quantum Fourier transform will give said quantum singular valueestimation of said product of both first and second matrices, once saidquantum memory has successively contained first matrix and secondmatrix, said quantum singular value estimation of said product of bothfirst and second matrices being said parameter representative of saidproduct of both first and second matrices.

This object is also achieved with a method of analysis of imagescomprising: performing a dimensionality reduction step, by processing,for several first matrices and for several second matrices, a parameterrepresentative of a product of both first and second matricesrespectively representing the pixels of both a first and a secondimages, wherein: both quantum singular value estimation of first matrixand quantum singular value estimation of second matrix are estimatedeach and are combined together so as to get at a quantum singular valueestimation of said product of both first and second matrices, by makinga phase estimation of an entity at least successively performing:quantum singular value estimation of first matrix, quantum rotations,proportional to estimated singular values of first matrix, preferablyquantum rotations on Y axis of Bloch sphere, proportional to estimatedsingular values of first matrix, quantum singular value estimation ofsecond matrix, quantum rotations, proportional to estimated singularvalues of second matrix, preferably quantum rotations on Y axis of Blochsphere, proportional to estimated singular values of second matrix,while applying to both first and second matrices following quantumcircuit including: a first Hadamard gate whose output is the input of afirst inverted quantum Fourier transform, said first Hadamard outputcontrolling following sub-circuit, a second Hadamard gate whose outputis the input of a second inverted quantum Fourier transform, said secondHadamard output controlling a quantum memory, output of said firstinverted quantum Fourier transform will give said quantum singular valueestimation of said product of both first and second matrices, once saidquantum memory has successively contained first matrix and secondmatrix, said quantum singular value estimation of said product of bothfirst and second matrices being said parameter representative of saidproduct of both first and second matrices.

Preferably, it is a method of classification of images among differentclasses and: said dimensionality reduction step is performed for saiddifferent classes on a training set of images whose classes are known,and then classifying one or more unknown images among said differentclasses with reduced dimensionality, said dimensionality reduction stepbeing performed on said training set of images by machine learningincluding processing, for at least a first matrix and for at least asecond matrix, a parameter representative of a product of two first andsecond matrices to assess to which given classes several first givenimages respectively belong: first matrix representing the concatenation,for said several first given images, of the values of the pixels of eachsaid first given image, second matrix representing the concatenation,for said several first given images, of the values of differencesbetween the pixels of each said first given image and the pixels of asecond given image different from said first given image but known tobelong to same class as said first given image.

Preferred embodiments comprise one or more of the following features,which can be taken separately or together, either in partial combinationor in full combination, in combination with any of preceding objects ofthe invention.

Preferably, operation of said combination of both quantum singular valueestimation of first matrix and quantum singular value estimation ofsecond matrix together, via quantum calculation, so as to get at aquantum singular value estimation of said product of both first andsecond matrices, is used to replace either an operation of matricesmultiplication and/or an operation of matrix inversion on matricesmultiplication.

This method of image classification according to the invention, isparticularly efficient and useful to replace some calculations whichwould otherwise remain very hard and complex operations, among whichthere are first matrices multiplication and second matrix inversion.

Preferably, said values of the pixels of first given image representvalues of levels of gray, advantageously over a range of 256 values,said values of differences between the pixels of first given image andsecond given image represent values of levels of gray, advantageouslyover a range of 256 values.

This method of image classification according to the invention, is quiteuseful to detect images having a complicated and intricate shape whichdoes not look any easier or simpler even when the image is digitalized.

Preferably, said first images are handwritten digits, said classes arethe different possible digits, said method of classification performs anautomatic recognition of handwritten digits.

This method of image classification according to the invention, can finda specific application which is very interesting, where it would beotherwise hard to get at a good result which would remain reliable,whatever the specific set of images to be classified, such images to beclassified still remaining within the boundaries of a given category ofimages.

Preferably, said first matrix includes one of said several given firstimages per line, or said first matrix includes one of said several givenfirst images per column.

Preferably, said first image is itself the concatenation of severalimages, advantageously one image per line or per column, said secondimage is itself the concatenation of several images, advantageously oneimage per line or per column.

Preferably, said first images are concatenations of handwritten digits,said classes are the different possible digits, said method ofclassification performs an automatic recognition of handwritten digits.

Further features and advantages of the invention will appear from thefollowing description of embodiments of the invention, given asnon-limiting examples, with reference to the accompanying drawingslisted hereunder.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 shows an example of a block diagram representing a quantumsubroutine called UW used in a method of classification of images amongdifferent classes according to an embodiment of the invention.

FIG. 2 shows an example of a block diagram representing a quantumsubroutine called UP used in a method of classification of images amongdifferent classes according to an embodiment of the invention.

FIG. 3 shows an example of a block diagram representing a quantumsubroutine called UL used in a method of classification of images amongdifferent classes according to an embodiment of the invention.

FIG. 4 shows an example of a block diagram representing a quantumsubroutine called UD used in a method of classification of images amongdifferent classes according to an embodiment of the invention.

FIG. 5 shows an example of a block diagram representing therelationships existing between the different quantum subroutines used ina method of classification of images among different classes accordingto an embodiment of the invention.

FIG. 6 shows an example of different curves comparing the respectiveperformances of different image classification methods, including anexample of a method of classification of images among different classesaccording to an embodiment of the invention.

DETAILED DESCRIPTION OF THE INVENTION

Qubit or qbit will be indifferently used throughout whole text, it meansa quantum bit.

The quantum computation performed is a single-parameter quantumprocedure that performs the dimensionality reduction. The procedure toassign a label to the images uses quantum algorithms to perform thedimensionality reduction and classification. The preprocessing time islinear in the dimensionality of the dataset, but the time used forclassification performances is polylogarithmic, and thus isexponentially more efficient than the other classical algorithmsaccording to prior art. The procedure described is parameterized by avalue theta, a parameter that depends on a given dataset. It will alsobe explained how to estimate theta for a given dataset in the procedure.

This is the setting that is considered: an assumption is made to have adataset of N images with L different labels to classify, and a new imagewith unknown label. The correct label for the new image has to be found.The quantum algorithm for dimensionality reduction uses a recentscientific breakthrough, called singular value estimation. Thisalgorithm allows for building a superposition of the singular values ofa given matrix stored in QRAM in time poly logarithmic in the matrixdimension.

The following procedure uses a quantum computer to execute theoperations on step number 4. This quantum procedure will use a datastructure called QRAM that is described in Kerenidis2016 [Kerenidis,Iordanis, and Anupam Prakash. 2017. “Quantum gradient descent for linearsystems and least squares,” April. http://arxiv.org/abs/1704.04992]hereby incorporated by reference. A QRAM is a data structure where thequantum computer can have quantum access, and is the device used toinput data in a quantum computer.

Successive steps 1 to 10 will now be described, with sub-steps a,b,c forsome of them, and sub-sub-steps i,ii,iii, etc. . . . for some of them.

1. Collection the elements to be used as training set. This step isimportant, as the elements in the dataset should resemble as much aspossible the elements that the system will have to classify whenexecuted. Possibly, they should not have misclassified elements;otherwise the performance of the classifier may be affected.

2. Standardize the pattern collected and extract the most salientfeatures of the images that are relevant for classification.

a. Center in the picture the subject in the image under classification,and then reduce all the images to the same size.

b. If there are reasons to believe that the relevant part to identifythe image consist in its shape and not its color, it may be decided toconvert the image in black and white, in this way, reducing the amounton information elaborated we reduce further the overall complexity ofthe task.

c. In case the images are highly complex and contain many objects, itcan be decided to employ techniques of feature extraction for this typeof data, like edge detection, corner detection, and blob detection.

3. In case the digital representation of the patterns in the previoussteps was a sparse matrix (and therefore stored in memory usingdifferent techniques), converted the pattern into a vector of floatingpoint value. For an image, this can be done by juxtaposing the columnsone by one.

4. This vector is then eventually polynomially expanded (usually apolynomial of degree 2 or 3 suffices)

5. Each vector is normalized by removing the mean of the vectors in thetraining set.

6. Each component is scaled such that it has unitary variance.

7. The dataset is stored into QRAM which is called QRAM for X.

8. Then a new QRAM with samples of the pairwise derivatives of the datais constructed. This matrix is called matrix X_dot. Take a number ofsamples that is at least linear in the number of elements in the datasetX.

9. To perform the dimensionality reduction and also the classificationon a quantum computer, follow step a, otherwise, to perform theclassification on a classical computer, go to step b.

a. For each class in the training set, use the quantum computer toperform U_(DR): the dimensionality reduction on the sample to classifyand a cluster of choice. Specifically:

i. Start with two empty registers and apply an Hadamard on the firstregister.

ii. Controlled on the first register being zero, create a stateproportional to the training set of the class currently selected, andthe new vector. This can be done by doing a query to the QRAM of X once.Controlled on the first register being one, create a state with multiplecopies of the test vector under classification. The number of copies isthe same as the element in the class currently under testing.

iii. Then use U_(W) on the state which has been created. The operationU_(W) uses queries to the QRAM of X and ancillary registers.

iv. Now execute U_(P) on the state created in the previous step. U_(P)uses query to QRAM of X, queries to U_(L), and ancillary registers.

v. Use an Hadamard to create quantum interference on the data register.Repeat these steps and estimate the probability of reading 0 in thefirst register.

vi. Perform the necessary estimation of normalization factor, asdescribed in the following paragraph.

b. In case it is wanted to use other classification subroutines on aclassical computer, the following can be done:

i. Run U_(DR) on each element of the training set and then on the newelement to classify. Perform quantum tomography on the final state inthe quantum computer. This will allow for recovering a vector of a smalldimension.

ii. Once all the dataset is recovered and stored on classical storage(like classical RAM or a hard drive) choose the classificationprocedure:

If wanting to favor speed over accuracy, calculate the distance betweenthe barycenter of each cluster and the test vector to classify. Assignas label of the new vector under classification the label of the clusterwhose barycenter is closer. This is the same procedure that can beexecuted on the quantum computer, and leads to the same classificationaccuracy.

If preferring more accurate result and if willing to spend more time inthe procedure, do the following. For a given integer k (like 5), findthe k closest elements in the training set to your test vector. Labelthe new vector with the label that is most frequent among the k nearestneighbors.

iii. Keep the training set in the classical storage, along with theinformation of the barycenter of the clusters. If wanting to classifyfurther elements in the dataset, run U_(DR) on the new elements and runagain the computation of distance on a classical computer.

10. Once the system to perform classification is ready, there is stillthe task dealing with the problem of finding an estimate for theparameter theta. This can be done by repeating the classificationprocedure with various values of theta from 0 to 1 and doing binarysearch over the parameter space. The parameter is meant to be foundexperimentally, and change with different dataset. It can be estimatedrunning the procedure several times for N possible values between 0 and1 uniformly. Until the desired accuracy is got, split the interval withbiggest classification accuracy into N other intervals, and find the newtheta value for which the biggest accuracy is got. This procedureguarantees to find the best possible tetha with the desired accuracyefficiently.

At the end of the quantum computation, the register holds the data ofthe training data moved in a small dimensional space. A classificationprocedure can be suggested which will be based on the estimate of theaverage of the distances between a test point to classify and the centerof each cluster. There can be noted that during the computation, theregisters of the quantum computers store all the dataset insuperposition, thus allowing the simultaneous application of theoperation on all the vectors. Since the operations inside the quantumcomputer are inherently randomized, due to the probabilistic nature ofquantum mechanics, techniques such as amplitude amplification can beused to further decrease the runtime of the classification.

FIG. 1 shows an example of a block diagram representing a quantumsubroutine called UW used in a method of classification of images amongdifferent classes according to an embodiment of the invention.

A QRAM of X 1 is connected to an input of a SVE 2 of X. A first outputof SVE 2 is connected to the input of an inverted arcsine function 3whose output is connected to an arcsine function 5 and controls a Yrotation 4. A second output of SVE 2 is directly connected to a secondinput of an inverted SVE 6 of X. Y rotation 4 is connected between athird output of SVE 2 and a third input of inverted SVE 6. A qubitmeasure 7 is performed on third output of inverted SVE 6.

This procedure takes as input a quantum register and two ancillaryregister, and output a quantum register. It uses multiple calls to theQRAM of X. Following steps 1 to 5 will be successively performed:

1. Perform Singular Value Estimation (as in Kerenidis2016 alreadyincorporated by reference) to write in a register the singular values ofthe matrix X in superposition.

2. Then, by using arithmetic operations on quantum register, exploit thesymmetry of trigonometric functions to map each singular value in itsinverse. This can be done using a library for arithmetic operations on aquantum computer.

3. Execute a Y rotation over an ancillary qubit controlled on theregister created in the previous step.

4. Execute the inverse of the trigonometric function and the inverse ofthe circuit used to perform SVE (singular value estimation) on X, inthis way the quantum register used to store the superposition ofsingular values is emptied.

5. Optionally, measure the ancilla qubits until 0 is read. In case 1 isread, repeat the procedure. This step can be postponed to the end of thequantum program. This will allow for applying techniques of amplitudeamplification to speedup even further the estimation of the finalresult, which is contained in the middle register.

FIG. 2 shows an example of a block diagram representing a quantumsubroutine called UP used in a method of classification of images amongdifferent classes according to an embodiment of the invention.

The quantum subroutine UW 11 of FIG. 1 is connected to an input ofquantum subroutine UL 12 which will be described in FIG. 3. A firstoutput of quantum subroutine UL 12 is connected to the input of a squarefunction of X 13 whose output is connected to an inverted squarefunction of register X 15 and controls X referenced 14. A second outputof subroutine UL 12 is directly connected to a second input of aninverted subroutine UL 16. Register X 14 is connected between a thirdoutput of subroutine UL 12 and a third input of inverted subroutine UL16. A qubit measure 7 is performed on third output of invertedsubroutine UL 16.

This procedure takes as input a quantum register and two ancillaryregister, and output a quantum register. Following steps 1 to 5 will besuccessively performed:

1. Use U_(L) to store in a quantum register the singular values of thematrix in superposition.

2. Using a quantum linear algebra library, square the values of thefirst register, as shown in the image.

3. Execute a controlled negation gate over an ancillary qubitparameterized by theta.

4. Execute the inverse of the square of the first register and theinverse of U_(L), in this way the quantum register used to store thesuperposition of singular values will be emptied.

5. Optionally, measure the ancilla qubits until we 0 is read. In case 1is read, repeat the procedure. This step can be postponed to the end ofthe quantum program. This will allow for applying techniques ofamplitude amplification to speedup even further the estimation of thefinal result, which is contained in the middle register.

FIG. 3 shows an example of a block diagram representing a quantumsubroutine called UL used in a method of classification of images amongdifferent classes according to an embodiment of the invention.

Output of an Hadamard 21 is connected to input of an inverted QuantumFourier Transform 23 (QFT) and controls a quantum subroutine callede{circumflex over ( )}(iH) 22 which will be described below in moredetails through following sub-steps 2.1 to 2.3.

This step is used to create a quantum register with the superposition ofthe singular values of the product of two matrices X and X_dot, havingthem stored in QRAM. This procedure takes as input a quantum register,and two ancillary register. It is to be noted that, since calculatingthe singular values of the product of two matrixes has never been donebefore, this represents an unprecedented step that no one has ever donebefore on a quantum computer. This new step is an effort combiningprevious results in quantum information, using phase estimation andsingular value estimation algorithms. Following steps 1 to 3 will besuccessively performed:

1. Create, using an Hadamard, a uniform superposition of elements in anindex register. Use this register to perform phase estimation as such.

2. Controlled on the index register, do the following unitary:

2.1. Apply a Hadamard gate in order to create a uniform superposition ofvalues on another register.

2.2. Controlled on the second index register, execute on a new registerSVE on X and controlled operation to apply the matrix X to the quantumstate, and execute on a new register SVE on X_dot and controlledoperation to apply the matrix X_dot on the state.

2.3. Perform amplitude amplification on 0 on the second index register.

3. Perform an inverse QFT on the first register.

In the image that represents the quantum circuit, steps 2.1 to 2.3 areexecuted inside the controlled unitary matrix that is callede{circumflex over ( )}(iH) 22.

To be more precise and more detailed about what is done in quantumsubroutine UL and in the controlled unitary matrix that is callede{circumflex over ( )}(iH) 22, here are some complementary explanations.

Performing “controlled operations” means that there are two register: Aand B. Generically, an operation on the register B is performed if theregister A is in a certain state. Since the register A is in asuperposition of states, multiple operations are performed on the secondregister as well.

For doing quantum subroutine UL, following operations are done:

On the first register the superposition (with Hadamard matrix) of allthe numbers from 0 to some integer N is created. Then, controlled onthis register, all the following operations are done:

apply the first matrix,

apply the second matrix,

Then, perform the QFT{circumflex over ( )}{−1} (inverted Quantum FourierTransform) to read (magically) the singular values of the product of thetwo matrices stored in QRAM.

“apply the matrix” means the following steps:

perform singular value estimation to write the eigenvalues of a matrixin a new register,

add a new ancilla qubit,

perform a rotation on the Y axis on the ancilla qubit controlled on theregister that has the superposition of singular values. The rotation isproportional to the singular value written in the register. Since thereare many of them (it is a superposition), basically more controlledrotations are performed “at the same time”.

perform the inverse of singular value estimation to empty the registerwith the singular values. The Y axis is really the Y axis in X,Y,Z axisof a 3-Dimensional sphere that represents the qubit, which is alsocalled the Bloch Sphere . . . it would also be possible to perform othercontrolled rotations than Y controlled rotations instead.

FIG. 4 shows an example of a block diagram representing a quantumsubroutine called UD used in a method of classification of images amongdifferent classes according to an embodiment of the invention.

Output of an Hadamard 31 is connected to input of an Hadamard 33 andcontrols a quantum subroutine UDR 32 which will be described below inmore details. There is a qubit measure 34 performed on output ofHadamard 33.

Now, quantum subroutine U_(D) and its use in classification will bedescribed.

This procedure uses access to a U_(DR) oracle, a QRAM access to thevectors of K different clusters, and ensures a label for a newunclassified vector. The pattern is labeled with the label of the classwith minimum average squared distance. This probability is proportionalto the square average distance of the test vector and the cluster ofpoints. Following steps 1 to 4 are performed to estimate the averagesquared distance.

1. For each different class in the dataset:

1.1. Start with a qubit in state 0 and perform an Hadamard over it.

1.2. Perform a controlled operation on this qubit. If the state is zero,perform U_(DR) on the data of the cluster currently chosen. If in thestate 1, use U_(DR) to create a state proportional to the vector underclassification.

1.3. Perform a Hadamard on the ancilla qubit to create quantuminterference.

2. Repeat this procedure from Step 1 until it is estimated with thedesired accuracy the probability that 0 is read in the ancilla qubit.

3. Estimate the necessary normalization values of the quantum state usedin this procedure. This can be done in the following way. Put a qubit in0 state and apply an Hadamard on it.

Controlled on the ancilla register being 0, use U_(DR) on all theelements with a given label.

Controlled on the ancilla register being 1, create a superposition whoseamplitude is proportional to a known value (i.e. the norm of a singlevector).

From the probability of measuring 0 in the ancilla qubit thenormalization factors can be recovered.

4. Assign the new vector to the cluster with minimum score. The score isproportional to the product between the normalization values and theprobability of reading zero in the procedure described above.

FIG. 5 shows an example of a block diagram representing therelationships existing between the different quantum subroutines used ina method of classification of images among different classes accordingto an embodiment of the invention.

QRAM of X 101 is used by quantum subroutine UW 103 and by quantumsubroutine UL 104. QRAM of X_dot 102 is used by quantum subroutine UL104. Quantum subroutine UW 103 is used by quantum subroutine UP 105.Quantum subroutine UL 104 is used by quantum subroutine UP 105. Quantumsubroutine UP 105 is used by quantum subroutine UD 106. Quantumsubroutine UD 106 is used by classification processing 107.

On FIG. 5, there is the description of the relationship between thequantum operations which are executed on the quantum computer. Due tothe nature of quantum computers, each step might use multiple oraclecalls to other subroutines. For instance, the quantum circuit that isnamed U_(L) is used inside the subroutine that is named U_(P). Thequantum circuit that is named U_(W) is used only inside the quantumcircuit U_(P). The subroutine used to calculate score used to performclassification (U_(D)) calls U_(P) for each label in the dataset. Thetwo oracles (called QRAM in quantum machine learning context) for X andfor X_dot are used both to create the quantum states that represent thedata, and inside the function calls of singular values estimation thatare used inside U_(L) and U_(W).

Now a specific example will be described in more details.

Public datasets represent a pool of standard benchmarking forclassification algorithms. The previous procedure was tested withclassical software that simulates the quantum procedure, and testedagainst the MNIST dataset of handwritten digits. This dataset is freelyavailable and distributed online and is the first choice for testingclassification algorithms. It is a set of 60.000 handwritten digits forthe training set, and other 10.000 of the test set. Several machinelearning algorithms are benchmarked against the MNIST dataset. For alist of the performance of various classification algorithms applied toMNIST dataset, one can refer to LeCun [LeCun, Yann. n.d. “The MNISTdatabase of handwritten digits.” Http://Yann. Lecun. dCom/Exdb/Mnist/.]hereby incorporated by reference. The previous procedure thus findsimplementation on real data in the following steps 1 to 9:

1. Then, the data is read in memory in a suitable representation ofvectors, specifically of floating point numbers with 64 bits ofprecision.

2. In the MNIST dataset, the images are already in black and white, andthey appear in center of a tile of 28×28 pixel.

3. The image is converted into its vector representation as list offloating point's numbers.

4. Then, the data is preprocessed:

a. Normalized such that the average of each component of the vector is0.

b. Scaled such as the variance of each component of the vector is 1

5. The preprocessed data represented by a matrix X is then stored in ourquantum software representing a QRAM for the matrix X.

6. Samples from the derivatives of the normalized dataset are taken,forming the second matrix X_dot. This data is stored in the secondsoftware representation of a QRAM.

7. The simulation of the operation performed by the quantum circuits isperformed. In this embedding, there is a simulation of thelinear-algebraic operation of quantum mechanics, explicitly adding theerror committed during the quantum algorithm due to noise.

8. After the quantum procedure, the data is represented as quantum statein a small dimensional space where classification can be performedefficiently.

9. Simulation of the same classification rule that was described in theclassification step of the quantum computer and collected the statisticsto measure the classification accuracy is performed.

This has shown execution on a real data to prove high accuracy ofclassification procedure.

This is an important key for claiming that this realized procedure thatuses quantum computer works in practice. In order to claim that theprocedure will work on real quantum computers, it was interesting toshow that the error in the precision of the calculation that wascommitted in the various operations on the quantum computer will nothinder the classification accuracy. To do this, there was a simulationof the quantum subroutines using a classical computer, inserting thesame error committed during the quantum procedures. The errors are dueto the singular value estimation step of the matrix X in U_(W), and inthe subroutine U_(P). To measure the impact of these errors, there wasartificially inserted error in the classical simulation as follows:

a. Inserting Gaussian noise in the estimate of the singular values inSVE of matrix X in step U_(W).

b. Error in the controlled rotation performed in the unitary U_(P).Putting an error in this step will imply a less precise dimensionalityreduction; therefore the data is projected in a slightly bigger subspacethan expected.

The error can expressed as the accuracy required in performing theprevious operation, has been chosen in this simulation to be coherentwith the expected performances on the hardware of quantum computers:there is an assumption to be precise up to the sixth significant digitsin these calculations.

FIG. 6 shows an example of different curves comparing the respectiveperformances of different image classification methods, including anexample of a method of classification of images among different classesaccording to an embodiment of the invention.

The experiments with the performance accuracy with and without theerrors are described in FIG. 6. Along the horizontal axis there arevarious values of PCA dimensionality reduction of the initial dataset.This step is used to study how performance of a classifier might vary bychanging the quality of the data. In this case, it is also used todecrease the size of the dataset such that is possible to perform withclassical computer a simulation of the quantum algorithm, that wouldhave not been possible otherwise. On the vertical axes, the accuracy ofthe classification algorithm measured in terms of percentage ofmisclassified images in the test set. The graph plots the classificationaccuracy made using three different procedures.

The curve 201 is plotted using the state of the art framework andtechniques for doing classification. It is obtained using purelyclassical software.

The curve 202 shows the accuracy of the classification performed usingquantum computers assuming operations up to 6 digits of precision in thesimulation of the quantum operations can be performed, with a first typeof preprocessing.

The curve 203 shows the accuracy of the procedure using quantum computerwith a second type of preprocessing.

From the FIG. 6, it is possible to see that all the curves 201 to 203eventually converge around 97% with an initial polynomial expansion of2. Classical algorithms perform better with small dimension of thedataset, but the execution time is sensibly slower on big datasets.

The invention has been described with reference to preferredembodiments. However, many variations are possible within the scope ofthe invention.

The invention claimed is:
 1. A method of analysis of images comprising:performing a dimensionality reduction step, oby processing, for at leasta first matrix and for at least a second matrix, a parameterrepresentative of a product of both first and second matricesrespectively representing the pixels of both a first and a secondimages, wherein: a quantum singular value estimation is performed onfirst matrix, a quantum singular value estimation is performed on secondmatrix, both quantum singular value estimation of first matrix andquantum singular value estimation of second matrix are combinedtogether, via quantum calculation, so as to get at a quantum singularvalue estimation of said product of both first and second matrices, saidquantum singular value estimation of said product of both first andsecond matrices being said parameter representative of said product ofboth first and second matrices.
 2. The method of classification ofimages among different classes according to claim 1, wherein: saiddimensionality reduction step is performed for said different classes ona training set of images whose classes are known, and then one or moreunknown images are classified among said different classes with reduceddimensionality, said dimensionality reduction step being performed onsaid training set of images by machine learning including processing,for at least a first matrix and for at least a second matrix, aparameter representative of a product of two first and second matricesto assess to which given classes several first given images respectivelybelong: ofirst matrix representing the concatenation, for said severalfirst given images, of the values of the pixels of each said first givenimage, osecond matrix representing the concatenation, for said severalfirst given images, of the values of differences between the pixels ofeach said first given image and the pixels of a second given imagedifferent from said first given image but known to belong to same classas said first given image, and wherein said quantum singular valueestimation of said product of both first and second matrices being saidparameter representative of said product of two first and secondmatrices processed to assess to which given classes said several firstgiven images respectively belong.
 3. The method of classification ofimages according to claim 2, wherein: said first matrix includes one ofsaid several given first images per line, or said first matrix includesone of said several given first images per column.
 4. The method ofclassification according to claim 2, wherein: said first images arehandwritten digits, said classes are the different possible digits, saidmethod of classification performs an automatic recognition ofhandwritten digits.
 5. The method of analysis of images according toclaim 1, wherein: said first image is itself the concatenation ofseveral images, advantageously one image per line or per column, saidsecond image is itself the concatenation of several images,advantageously one image per line or per column.
 6. The method ofanalysis of images according to claim 1, wherein the method performsclassification of images among different classes and wherein: saiddimensionality reduction step is performed for said different classes ona training set of images whose classes are known, and then classifyingone or more unknown images among said different classes with reduceddimensionality, said dimensionality reduction step is performed on saidtraining set of images by machine learning including processing, for atleast a first matrix and for at least a second matrix, a parameterrepresentative of a product of two first and second matrices to assessto which given classes several first given images respectively belong:ofirst matrix representing the concatenation, for said several firstgiven images, of the values of the pixels of each said first givenimage, osecond matrix representing the concatenation, for said severalfirst given images, of the values of differences between the pixels ofeach said first given image and the pixels of a second given imagedifferent from said first given image but known to belong to same classas said first given image.
 7. The method of classification according toclaim 1, wherein: operation of said combination of both quantum singularvalue estimation of first matrix and quantum singular value estimationof second matrix together, via quantum calculation, so as to get at aquantum singular value estimation of said product of both first andsecond matrices, is used to replace either an operation of matricesmultiplication and/or an operation of matrix inversion on matricesmultiplication.
 8. The method of classification according to claim 1,wherein: said values of the pixels of first given image represent valuesof levels of gray, advantageously over a range of 256 values, saidvalues of differences between the pixels of first given image and secondgiven image represent values of levels of gray, advantageously over arange of 256 values.
 9. The method of classification according to claim1, wherein: said first images are concatenations of handwritten digits,said classes are the different possible digits, said method ofclassification performs an automatic recognition of handwritten digits.10. The method of analysis of images comprising: performing adimensionality reduction step, oby processing, for several firstmatrices and for several second matrices, a parameter representative ofa product of both first and second matrices respectively representingthe pixels of both a first and a second images, wherein: both quantumsingular value estimation of first matrix and quantum singular valueestimation of second matrix are estimated each and are combined togetherso as to get at a quantum singular value estimation of said product ofboth first and second matrices, by making a phase estimation of anentity at least successively performing: oquantum singular valueestimation of first matrix, oquantum rotations, proportional toestimated singular values of first matrix, oquantum singular valueestimation of second matrix, oquantum rotations, proportional toestimated singular values of second matrix, said quantum singular valueestimation of said product of both first and second matrices being saidparameter representative of said product of both first and secondmatrices.
 11. The method of claim 10, wherein the step of performingquantum rotations proportional to estimated singular values of firstmatrix is performed as quantum rotations on Y axis of Bloch sphere,proportional to estimated singular values of first matrix.
 12. Themethod of claim 11, wherein the step of performing quantum rotations,proportional to estimated singular values of second matrix is performedas quantum rotations on Y axis of Bloch sphere, proportional toestimated singular values of second matrix.
 13. The method of claim 10,wherein the step of performing quantum rotations, proportional toestimated singular values of second matrix is performed as quantumrotations on Y axis of Bloch sphere, proportional to estimated singularvalues of second matrix.
 14. A method of analysis of images comprising:performing a dimensionality reduction step, oby processing, for severalfirst matrices and for several second matrices, a parameterrepresentative of a product of both first and second matricesrespectively representing the pixels of both a first and a secondimages, wherein: both quantum singular value estimation of first matrixand quantum singular value estimation of second matrix are estimatedeach and are combined together so as to get at a quantum singular valueestimation of said product of both first and second matrices, byapplying to both first and second matrices following quantum circuitincluding: oa first Hadamard gate whose output is the input of a firstinverted quantum Fourier transform, osaid first Hadamard outputcontrolling following sub-circuit, a second Hadamard gate whose outputis the input of a second inverted quantum Fourier transform, said secondHadamard output controlling a quantum memory, ooutput of said firstinverted quantum Fourier transform will give said quantum singular valueestimation of said product of both first and second matrices, once saidquantum memory has successively contained first matrix and secondmatrix, said quantum singular value estimation of said product of bothfirst and second matrices being said parameter representative of saidproduct of both first and second matrices.
 15. The method of analysis ofimages according to claim 14, wherein: wherein: both quantum singularvalue estimation of first matrix and quantum singular value estimationof second matrix are estimated each and are combined together so as toget at a quantum singular value estimation of said product of both firstand second matrices, by making a phase estimation of an entity at leastsuccessively performing: oquantum singular value estimation of firstmatrix, oquantum rotations, proportional to estimated singular values offirst matrix, oquantum singular value estimation of second matrix,oquantum rotations, proportional to estimated singular values of secondmatrix, while applying to both first and second matrices followingquantum circuit including: oa first Hadamard gate whose output is theinput of a first inverted quantum Fourier transform, osaid firstHadamard output controlling following sub-circuit, a second Hadamardgate whose output is the input of a second inverted quantum Fouriertransform, said second Hadamard output controlling a quantum memory,ooutput of said first inverted quantum Fourier transform will give saidquantum singular value estimation of said product of both first andsecond matrices, once said quantum memory has successively containedfirst matrix and second matrix, said quantum singular value estimationof said product of both first and second matrices being said parameterrepresentative of said product of both first and second matrices. 16.The method of claim 15, wherein the step of performing quantumrotations, proportional to estimated singular values of first matrix isperformed as quantum rotations on Y axis of Bloch sphere, proportionalto estimated singular values of first matrix.
 17. The method of claim16, wherein the step of performing quantum rotations, proportional toestimated singular values of second matrix is performed as quantumrotations on Y axis of Bloch sphere, proportional to estimated singularvalues of second matrix.
 18. The method of claim 15, wherein the step ofperforming quantum rotations, proportional to estimated singular valuesof second matrix is performed as quantum rotations on Y axis of Blochsphere, proportional to estimated singular values of second matrix.